perm filename F.OUT[CLS,LSP] blob sn#826521 filedate 1986-10-20 generic text, type T, neo UTF8
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

**** File 1) FUNCTI.2[CLS,LSP]/1P/108L
1)	\label Syntax:
1)	\label Examples:
1)	\endcom
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/108L
2)	{\bf call-next-method} is used within the body of a method.  It calls
2)	the "next method" with the same arguments that this method received.
2)	For the precise definition of "next method", see the section "Method 
2)	Combination".  {\bf call-next-method} returns the value or values
2)	returned by the method it calls.  Further computation after {\bf
2)	call-next-method} returns is possible, so this provides a general
2)	imperative form of method-combination.
2)	The type of method combination in use determines which kinds of methods
2)	allow {\bf call-next-method} to be used.  The default method combination
2)	type, {\bf :daemon}, allows {\bf call-next-method} to be used inside
2)	primary methods and {\bf :around} methods.  If you define a new type of
2)	method combination using the simple form of {\bf define-method-combination}, 
2)	{\bf call-next-method} can be done in {\bf :around} methods only.
2)	\label Syntax:
2)	\Defun {call-next-method}
2)	\label Arguments:
2)	{\bf call-next-method} is called with no arguments.
2)	\label Values:
2)	{\bf call-next-method} returns the value or values returned by the
2)	method it calls. 
2)	 
2)	\label Remarks:
2)	If {\bf call-next-method) runs out of methods, it signals an error. 
2)	The exact definition of "same arguments" is still under discussion and must
2)	be clarified.  This is particularly complicated in the face of optional,
2)	rest, and keyword parameters.  {\bf call-next-method} passes the actual values of
2)	the parameter variables to the next method, except for keyword parameters,
2)	which are passed via a rest-argument, not individually.  Thus defaulted
2)	optional parameters cannot be defaulted again by the next method, but
2)	keyword parameters can be re-defaulted by the next method.  If a parameter
2)	variable is {\bf setq}'ed, or another variable with the same name is bound, the
2)	variable value visible at the lexical position of the {\bf call-next-method} form
2)	is used.
2)	Possible extensions:
2)	{\bf call-next-method} {\it arguments\/}  When at least one argument is
2)	given, {\bf call-next-method} supplies those
2)	arguments instead of the arguments that this method received.  
2)	{\bf apply-next-method} {\it arguments\/} This is like {\bf
2)	call-next-method} except that it uses {\bf apply} instead of {\bf
2)	funcall}.  That is, the last argument is really a list of arguments.
2)	\label See Also:
2)	See the sections "Method Selection" and "Method Combination". 
2)	\endcom
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/158L
1)	The function {\bf class-of} returns the class of a given object.
1)	\label Syntax:
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/212L
2)	The function {\bf class-of} returns the most specific class of which the 
2)	given object is an instance.   Every Common Lisp object has a class.  
2)	\label Syntax:
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/180L
1)	If the object was created with {\bf make-instance} and its clas was
1)	not changed, the class that is
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/235L
2)	If the object was created with {\bf make-instance} and its class was
2)	not changed, the class that is
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/204L
1)	The macro {\bf defclass} defines a new class.  It returns
1)	the name of the new class as its result.
1)	\label Syntax:
1)	\cboxfig{
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/259L
2)	The macro {\bf defclass} defines a new class, which is a template of a
2)	new data type with named slots.  It returns the name of the new class as 
2)	its result.
2)	{\bf defclass} syntax offers options that allow for providing default
2)	initialization of the slots, and for requesting that functions be 
2)	automatically generated to read and write the values of the slots, or to
2)	construct new instances.   By default, no accessor, reader, constructor,
2)	or predicate function is defined.   Also, slots are not by default
2)	initable. 
2)	When you define a class you are also defining a type.  That is, 
2)	({\bf typep} {\it object class-name\/})  
2)	is true if the object is an instance of the given class.
2)	\label Syntax:
2)	[Note:   can you put the following Syntax description into the box format?]
2)	(defclass class-name ({super-class-name}*) ({slot-spec}*) {class-option}*)
2)	class-name ::= a non-null symbol
2)	super-class-name ::= a non-null symbol
2)	slot-spec ::=  slot-name | 
2)	               (slot-name default-value) |
2)	               (slot-name {slot-option}*) 
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

2)	slot-option ::= :default-value form |
2)			:accessor generic-function-name |
2)			:reader generic-function-name |
2)			:initable keyword |
2)			:allocation allocation-type |
2)			
2)	allocation-type ::= :instance | :class | :none | :dynamic 
2)	class-option ::= (:documentation string) |
2)	                 (:accessor-prefix string-or-symbol) |
2)			 (:reader-prefix string-or-symbol) |
2)			 :initable-slots |
2)			 (:metaclass class-name) |
2)			 (:instantiable t-or-nil) 
2)			 (:predicate symbol) 
2)			 (:constructor symbol [boa-arglist]) 
2)	boa-arglist ::= as you have it below 
2)	\cboxfig{
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/250L
1)	[Discussion of {\bf defclass} syntax to go here.]
1)	The {\bf :instantiable} option specifies whether it is possible to directly
1)	instantiate this class with {\bf make-instance}.  If {\bf :instantiable} is
1)	{\bf nil}, the class cannot be instantiated and is termed an {\bf abstract
1)	class}.  The default value of {\bf :instantiable} is {\bf t}.
1)	\label Values:
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/348L
2)	{\it class-name\/ is a non-null symbol that names the class being
2)	defined.  If a class is already defined with this name, this definition
2)	replaces the old definition.
2)	Each {\it slot-spec\/} includes the name of the slot, which is a
2)	non-null symbol.   The {\it slot-name\/} can be given alone, or in a list.   
2)	{\it slot-spec\/} can be a list of the slot name and its {\it
2)	default-value\/}, which can be any form.  When an instance is made and
2)	no initial value for this slot is provided as an argument to {\bf
2)	make-instance}, the slot is initialized to the value of this form.  The
2)	{\it default-value\/} is evaluated every time it is used. 
2)	{\it slot-spec\/} can also be a list of the {\it slot-name\/} followed
2)	by one or more {\it slot-options\/}, each of which 
2)	specifies an option that is specific to this slot.  
2)	The defined {\it slot-options\/} are:
2)	{\bf :default-value} {\it form\/} This is an alternate way for providing
2)	a default initial value form.  The {\it form\/} is evaluated every time it is
2)	used.  
2)	{\bf :accessor} {\it generic-function-name\/} This specifies that a
2)	method for an accessor function should automatically be generated for
2)	this slot.  An accessor is used to to read the value of this slot, and
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

2)	{\bf setf} may be used with it to write the value of the slot.  {\it
2)	generic-function-name\/} must be a non-null symbol.
2)	{\bf :reader} {\it non-null-symbol\/} This specifies that a method for a
2)	reader function should automatically be generated for this slot.  The
2)	reader is a generic function named {\it non-null-symbol\/}.  A reader is
2)	used to read the value of the slot.   This option does not cause a {\bf
2)	setf} function to be defined.  {\it generic-function-name\/} must be a
2)	non-null symbol.
2)	{\bf :initable} {\it keyword\/} This specifies a keyword to be used to
2)	specify an initial value of this slot, when a new instance is being
2)	made.  {\it keyword\/} must be a non-nil symbol.
2)	{\bf :allocation} {\it allocation-type} This specifies where storage is
2)	allocated for this slot.  The {\it allocation-type\/} can be one of 
2)	these keywords: {\bf :instance}, {\bf :class}, {\bf :dynamic}, {\bf :none}.  The
2)	semantics of these keywords are:
2)	{\bf :instance} Storage is allocated in the instance itself; each
2)	instance has its separate value for this slot.  This is the default.
2)	{\bf :class} Storage is allocated in the class.  Thus a single value for
2)	this slot is shared by all instances.  The exact semantics of {\bf
2)	:class} are still under discussion.  For example, how are subclasses
2)	handled?  Does each subclass have a separate copy of this slot, or do
2)	all subclasses share the same copy?
2)	{\bf :dynamic} This option is still under discussion; it is not yet 
2)	clear whether it should be in the standard.  The purpose of this option
2)	is to specify:  Storage is allocated in the instance at the time of the
2)	first use of the slot.  If the slot is initialized with a keyword
2)	argument to {\bf make-instance}, the slot is allocated then.  If the
2)	first access is a read, then storage is allocated and the default value
2)	declared in the {\bf defclass}, if any, is stored in the slot and
2)	returned.  If the first access is a {\bf setf}, then storage is
2)	allocated and the value is stored in the slot and returned.  This option
2)	allows infrequently-used slots to take storage only when necessary.
2)	{\bf :none} No storage is to be allocated; the slot should not exist in
2)	instances of this class.  This is used to override inheritance of slots
2)	defined by a super-class.
2)	Each {\it super-class-name\/} is a non-null symbol naming a class to be
2)	included as an integral part of this class.  The class now being defined
2)	will inherit characteristics (such as slots) and behavior (such as
2)	methods) from each of its super-classes.  Each {\it super-class-name\/}
2)	must refer to a user-defined class, not a  built-in class.  A built-in 
2)	class corresponds to one of the predefined Common Lisp type specifiers;
2)	for example {\bf array} is a built-in class for objects of type {\bf array}.
2)	Each {\it class-option\/} is an option that refers to the class.
2)	The set of defined options is:
2)	(:documentation string) This enables you to specify an arbitrary string
2)	as documentation for this class.  The form (documentation class-name
2)	'type) retrieves this string.
2)	(:instantiable t-or-nil) This option has not been discussed.
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

2)	This specifies whether it is possible to directly
2)	instantiate this class with {\bf make-instance}.  If {\bf :instantiable} is
2)	{\bf nil}, the class cannot be instantiated and is termed an {\bf abstract 
2)	class}.  The default value of {\bf :instantiable} is {\bf t}.
2)	(:predicate symbol)  This option has not been discussed yet.  This
2)	generates a predicate function named {\it symbol\/}, which must be a
2)	non-nil symbol.   The predicate function takes one argument, an object,
2)	and returns {\bf t} if the object is of this class, {\bf nil} otherwise.  
2)	(:accessor-prefix string-or-symbol) This causes a method for an accessor
2)	generic function to be generated automatically for each slot.  
2)	The accessor is used to read the value of a slot and can be
2)	used with {\bf setf} to write the value of a slot.  The name of each 
2)	accessor is the prefix {\it string-or-symbol\/} followed by the name of
2)	the slot.
2)	(:reader-prefix string-or-symbol) This causes a method for a reader
2)	generic function to be generated automatically for each slot.  The
2)	reader is used to read the value of a slot.  This option does not cause
2)	a {\bf setf} function to be defined.  The name of each reader is the
2)	prefix {\it string-or-symbol\/} followed by the name of the slot.
2)	:initable-slots This specifies that it is allowed to initialize all
2)	slots of this class.  The initialization can be done by providing the
2)	keyword with the same name as the slot, followed by the slot's initial
2)	value as an argument to {\bf make-instance}, or by including the keyword
2)	and value in the {\bf :default-init-plist}.
2)	(:default-init-plist {keyword argument}*) This option is still under
2)	discussion; it is not yet clear whether it will be in the standard.  The
2)	purpose of this option is to:  Set up defaults that are used when making 
2)	an instance.   For example, a class might specify a default value to 
2)	use to initialize a slot inherited from one of its super-classes. 
2)	Each {\it keyword\/} must be a valid keyword argument to
2)	{\bf make-instance}.  Each {\it argument\/} is a form that provides the default
2)	value for that keyword argument if it is not supplied.  The user can
2)	override the defaults in the {\bf :default-init-plist} by providing
2)	keyword arguments to {\bf make-instance}.  The {\it arguments\/} are evaluated
2)	every time they are used.
2)	(:init-keywords {keyword}*) This option is still under discussion; it is
2)	not yet clear whether it should be in the standard.  The purpose of this
2)	option is to:  Specify that each given keyword is an allowed keyword
2)	argument to {\bf make-instance} for this class.  There is no need to
2)	provide this argument to make it possible to initialize slots; that is
2)	done with the {\bf :initable-slots} option.  The {\bf :init-keywords}
2)	option is used in conjunction with methods you have written for {\bf
2)	make-instance}.  If a {\bf make-instance} method accepts an argument,
2)	you must explicitly make it an allowed keyword argument to {\bf
2)	make-instance} by using this option.
2)	(:constructor symbol [boa-arglist]) This causes a constructor function
2)	named {\it symbol\/} to be generated automatically.  The constructor is
2)	used to make a new instance of the class.  If no {\it boa-arglist\/} is
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

2)	present, the constructor takes keyword arguments.  If {\it
2)	boa-arglist\/} is present, it describes the arguments to the
2)	constructor.  The syntax of the {\bf :constructor\/} option to {\bf
2)	defclass} is the same as that of the {\bf defstruct :constructor} option
2)	described in "Common Lisp the Language".
2)	(:metaclass class-name) This specifies that this class has a different
2)	implementation than the system-provided default.  If you have invented a
2)	new metaclass, this option is the mechanism for creating classes of that
2)	metaclass.  {\it class-name} is the name of a class that is capable of
2)	being the class of a class.
2)	\label Values:
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/265L
1)	[To be written.]
1)	\endscreen!
1)	\label Remarks:
1)	All the classes in the included classes tree of a class must be defined
1)	before an instance of the class may be created.
1)	A class must be defined before it can be mentioned as an argument specializer
1)	in a {\bf defmethod} form.
1)	All the classes in the included classes tree of a class must be
1)	defined before a {\bf with-slots} construct that makes reference to
1)	that class may be evaluated (compiled).
1)	\endcom
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/509L
2)	(defclass ship ()
2)	               (name
2)	                (x-velocity :accessor ship-x-vel)
2)	                (y-velocity :accessor ship-y-vel)
2)	                (mass :reader ship-mass))
2)	  :initable-slots)
2)	\endscreen!
2)	\label Remarks:
2)	Each class has a "component classes tree" composed of all its
2)	super-classes, and the super-classes of each of its super-classes, and so
2)	on.  This tree is used to compute the class precedence list of the class.
2)	See the section "Determining the Class Precedence List". 
2)	Note the following rules of {\bf defclass}:
2)	   - All the component classes of a class must be defined before it is
2)	     permitted to make an instance of the class.
2)	   - A class must be defined before it can be mentioned as an argument
2)	     specifier in a {\bf defmethod}.
2)	   - All component classes of a class must be defined before it is
2)	     permitted to evaluate or compile a {\bf with-slots} that uses this
2)	     class.
2)	Some implementations might add other options to {\bf defclass}.  Therefore it is
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

2)	required that all implementations signal an error if they observe an option
2)	that is not implemented locally.
2)	If no default value for a slot is specified either in the {\bf defclass} or the
2)	{\bf make-instance} form, the initial value of the slot is undefined and it is an
2)	error to reference it.  This is the same behavior as a {\bf defvar} with no
2)	initial value form.
2)	When the definition of a class changes, each existing instance of the class
2)	is updated to the new format the next time it is accessed.  (Note that this
2)	behavior might be categorized as an optional feature.)
2)	It is valid to specify more than one accessor, reader, and keyword for
2)	initialization, for a single slot.  For example, this can happen when
2)	the {\bf :accessor} slot option is used to specify an accessor for a 
2)	slot, and the {\bf :accessor-prefix} option is used to specify that all 
2)	slots should have an accessor with the supplied prefix. 
2)	If neither a reader nor an accessor is specified for a slot, the slot
2)	can only be accessed by the function {\bf slot-value} or {\bf
2)	with-slots} using {\bf :use-accessors nil}.
2)	\label See Also:
2)	{\bf with-slots}
2)	{\bf slot-value}
2)	See the section "Determining the Class Precedence List". 
2)	\endcom
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/288L
1)	The macro {\bf defgeneric} defines a named generic function and stores it
1)	in the symbol function cell of {\it name}.
1)	\label Syntax:
1)	\Defmac {defgeneric} {name lambda-list \ttbrac{documentation} \star{\curly{option}}}
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/576L
2)	The macro {\bf defgeneric} defines a generic function and stores it in
2)	the symbol function cell of the symbol that is its name.  The new
2)	generic function object is returned as the result.  {\bf defgeneric} 
2)	allows you to specify options and declarations that pertain to the 
2)	generic function as a whole. 
2)	It is still under discussion whether it should be required that a {\bf
2)	defgeneric} must be evaluated before any methods are defined, or whether
2)	{\bf defmethod} should set up a generic function with default options,
2)	if no {\bf defgeneric} has been evaluated.
2)	\label Syntax:
2)	(defgeneric generic-function-name lambda-list {option}*)
2)	option ::= (:documentation string) | string
2)	           (:method-combination name {argument}*)
2)	           (declare {declaration}+)
2)	           (:argument-precedence-order {parameter-name}+)
2)	           (:interface {form}+)
2)	           (:method-arguments {form}+)
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

2)	           (:generic-function-class class-name)
2)	           (:method-class class-name) 
2)	\Defmac {defgeneric} {name lambda-list \ttbrac{documentation} \star{\curly{option}}}
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/301L
1)	The {\it lambda-list\/} argument is a standard function lambda list.
1)	The {\bf :method-combination-type} argument specifies the method combination
1)	type for the generic function.    Its value can be either a method
1)	combination type or the name of a method combination type.
1)	%The default method combination type is {\bf :super-daemon}.
1)	The {\bf :argument-precedence-order} argument is used to specify the
1)	order in which the arguments in a call to the generic function are
1)	tested for specificity when dispatching to a particular method.  The
1)	{\bf :argument-precedence-order} argument is a list whose elements are
1)	the symbols specified in the {\bf lambda-list\/}.  If no {\bf
1)	:argument-precedence-order} argument is specified, the arguments in
1)	the call to the generic function are tested for specificity in
1)	left-to-right order.
1)	A documentation string can be attached to the name of the generic
1)	function by use of the optional {\it documentation\/} argument; the
1)	documentation type for this string is {\bf function}.
1)	\label Values:
1)	\label Examples:
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/608L
2)	{\it generic-function-name} is a non-null symbol naming the generic function.
2)	The {\it lambda-list\/} argument is an ordinary function lambda list
2)	with these exceptions:
2)	1.  No &aux variables are allowed. 
2)	2.  Optionals (including keyword arguments)may not have default-forms ur
2)	    use supplied-p, and hence the symbol does not imply a default value
2)	    of NIL.   Note that optionals in the methods can have default forms
2)	    and supplied-p. 
2)	The set of defined options is:
2)	(:documentation string) | string
2)	                Associates a documentation string with the generic
2)	                function.  The form (documentation generic-function-name
2)	                'function) retrieves this string.
2)	(:method-combination name {argument}*)
2)	                Indicates that the generic function uses the type of method
2)	                combination named by name.  The arguments depend on the
2)	                type of method combination.  The most common argument is
2)	                one to specify the order of methods, which is either
2)	                :most-specific-first or :most-specific-last.  The default
2)	                method combination type is :daemon, with the
2)	                :most-specific-first order.
2)	(declare {declaration}+)
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

2)	                Declarations that apply to the whole function (as opposed
2)	                to declarations of variables) are permitted.  The only
2)	                declaration in this standard is optimize, which can have
2)	                the value of speed or space.  This allows the user to
2)	                control whether method selection is optimized for speed or
2)	                space; it has no affect on individual methods.  Some
2)	                implementations might support other declarations.  If an
2)	                implementation notices a declaration that it does not
2)	                support, it should follow the rules described on page 161
2)	                of Common Lisp the Language.
2)	(:argument-precedence-order {parameter-name}+)
2)	                This option alters the default way of selecting methods.
2)	                By default, all required arguments are considered
2)	                from left to right; each required argument has
2)	                precedence over those to its right.  When this option is
2)	                used, each required argument should be included as a
2)	                parameter-name, so the full precedence order is supplied.
2)	(:interface {form}+)
2)			This option is under discussion.
2)	                Defines a function that runs instead of the generic
2)	                dispatch.  This is completely transparent to anyone calling
2)	                the generic function.  Such a prologue function can be used
2)	                to rearrange the arguments, to standardize the arguments
2)	                before the methods see them, to default optional arguments,
2)	                to do the shared non-generic portion of an operation, or
2)	                for any other purpose.  Another use of this option is to
2)	                extend a generic function so it can also be used for
2)	                objects that are not instances of a built-in class.
2)	                Inside the forms you can trigger the generic dispatch with
2)	                (call-methods args...) or (apply-methods args...).
2)	                apply-methods treats the last argument as a list of
2)	                arguments just like apply.  call-methods and apply-methods
2)	                are defined lexically only inside the :interface option.
2)	(:method-arguments {form}+)
2)			This option is under discussion. 
2)	                You can use this option to specify that the methods accept
2)	                different arguments than does the generic function itself.
2)	                By default, the methods receive the same arguments that are
2)	                specified at the top of the defgeneric form.  The
2)	                :method-arguments option is meaningful only in connection
2)	                with the :inteface option.
2)	(:generic-function-class class-name)
2)	                Specifies that this generic function has a different
2)	                implementation than the system-provided default.  If you
2)	                have invented a new generic function class, this option is
2)	                the mechanism for creating a generic function of the new
2)	                class.  class-name is the name of a class that is capable
2)	                of being the class of a generic function.
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

2)	(:method-class class-name)
2)	                This is used to specify that all methods for this generic
2)	                function have a different implementation than the
2)	                system-provided default.  If you have invented a new method
2)	                class, this option is the mechanism for creating methods of
2)	                the new class.  Once the defgeneric form with this option
2)	                is evaluated or compiled, any methods you define with
2)	                defmethod will be implemented in the class name specified
2)	                here.  class-name is the name of a class that is capable of
2)	                being the class of a method.
2)	\label Values:
2)	The new generic function object is returned as the result.
2)	\label Examples:
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/334L
1)	discrimination on optional arguments.
1)	The name of {\bf defgeneric} is subject to change, depending on the
1)	results of these decisions.
1)	If a {\bf defgeneric} form is reevaluated, a new generic function is
1)	installed in the symbol-function cell.
1)	\endcom
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/716L
2)	discrimination on optional arguments.  The name of {\bf defgeneric} is
2)	subject to change, depending on the results of these decisions.
2)	If a {\bf defgeneric} form is evaluated when a generic function of the
2)	same name is already defined, the new definition replaces the old.
2)	If a {\bf defgeneric} form is evaluated and some methods for that
2)	generic function have parameters that are not congruent with those
2)	listed in the {\bf defgeneric}, an error is signalled.  
2)	Some implementations might add other options to {\bf defgeneric}. 
2)	Therefore it is required that all implementations signal an error if
2)	they observe an option that is not implemented locally.
2)	\endcom
2)	\begincom{defgeneric-setf}
2)	\label Purpose:
2)	{\bf defgeneric-setf} enables you to define a {\bf setf} generic
2)	function.  The new generic function object is returned as the result.
2)	\label Syntax:
2)	(defgeneric-setf generic-function-name lambda-list setf-lambda-list {option}*)
2)	option ::= (:documentation string) | string
2)	           (:method-combination name {argument}*)
2)	           (declare {declaration}+)
2)	           (:argument-precedence-order {parameter-name}+)
2)	           (:interface {form}+)
2)	           (:method-arguments {form}+)
2)	           (:generic-function-class class-name)
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

2)	           (:method-class class-name) 
2)	\label Arguments:
2)	{\it generic-function-name} is a non-null symbol naming an accessor
2)	generic function.  
2)	The {\it lambda-list\/} argument is the same as for {\bf defgeneric}.
2)	{\it setf-lambda-list} is ({\it variable-name\/}).  {\it
2)	variable-name\/} is the name of the variable that gets bound to the
2)	value {\it foo\/} in ({\bf setf} ({\it name x y z\/}) {\it foo\/}).
2)	Like the variable names in the {\it lambda-list\/} it is only for
2)	documentation. 
2)	The keyword options are the same as for {\bf defgeneric}. 
2)	 
2)	\label Values:
2)	The new generic function object is returned as the result.
2)	\label Examples:
2)	\label Remarks:
2)	\label See Also:
2)	{\bf defgeneric}
2)	\endcom
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/350L
1)	\label Syntax:
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/791L
2)	{\bf define-method-combination} is a mechanism for declaring a new type
2)	of method combination.
2)	At present the details of this function and related functions are under
2)	discussion.    
2)	\label Syntax:
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/368L
1)	The macro {\bf defmethod} defines a new method.  It returns the new method
1)	as its result.
1)	The argument list must be compatible with the argument list of the
1)	generic function.
1)	If this condition does not hold, an error is signalled.
1)	[The following is under discussion:  A generic function of the given name
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/815L
2)	The macro {\bf defmethod} defines a new method for performing a generic
2)	function.  It returns the new method as its result.
2)	The argument list of the method must be congruent. with the argument
2)	list of the generic function.  If this condition does not hold, an error is
2)	signalled.  See "Remarks" for a definition of congruency in this
2)	context. 
2)	[The following is under discussion:  A generic function of the given name
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/380L
1)	\Defmac {defmethod} {generic-function-name
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/828L
2)	   (defmethod generic-function-name {qualifier}*
2)	              specialized-lambda-list 
2)	     {declaration | doc-string}*
2)	     {form}*)
2)	\Defmac {defmethod} {generic-function-name
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/404L
1)	[Discussion of {\bf defmethod} syntax to be written.]
1)	\label Values:
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/857L
2)	generic-function-name
2)	                A non-null symbol that names the generic function
2)	                being specialized.   
2)	qualifier       A non-null symbol OR a non-null atom (not agreed yet), used
2)	                by method combination to identify the method.  For
2)	                example, :before, :after, or :around. 
2)	specialized-lambda-list
2)	                A lambda-list as defined in Common Lisp the Language, page
2)	                60, possibly with some required arguments replaced by
2)	                specialized-variables so that method selection uses that 
2)	                argument.  A specialized-variable is a list such as:
2)	                (variable-name parameter-specifier).  A specialized-variable
2)	                may be used wherever a lambda-list allows only a
2)	                variable and not a list.  Only required parameters may 
2)	                be specialized.  [Note that the specialization on optional
2)	                parameters is still under discussion.]
2)	 
2)	parameter-specifier  
2)	 		parameter-specifier can be a user-defined class, or the name 
2)	                of a structure defined by defstruct if the :type option was
2)	                not used, or a Common Lisp type specifier from the subset
2)	                listed here:
2)	                array               integer          ratio
2)	                bit-vector          list             rational
2)	                character           long-float       readtable
2)	                compiled-function   null             sequence
2)	                complex             number           short-float
2)	                cons                package          single-float
2)	                double-float        pathname         string
2)	                float               quote      	     symbol
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

2)	                hash-table          random-state     t  
2)	                                                     vector
2)	                Note that the use of t as a parameter-specifier defines a
2)	                default method.  Such a method is selected only when no
2)	                more specific method for the generic function is defined.
2)	                Quote is used with an object to indicate that this
2)	                argument must be bound to the quoted object for this 
2)	                method to be applicable. 
2)	\label Values:
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/417L
1)	\endcom
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/912L
2)	\label Remarks:
2)	All methods of a generic function must have congruent argument lists.
2)	In this context, congruency implies that the system can determine whether
2)	a call is syntactically correct.   The rules are:
2)	1.  Methods must have the same number of required and optional
2)	arguments.
2)	2.  Methods must allow exactly the same keywords, or use
2)	&allow-other-keys appropriately.
2)	3.  Either all methods have use &rest or none of them use it.
2)	\endcom
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/424L
1)	The macro {\bf defmethod-setf} defines a setf method.  [To be written.]
1)	\label Syntax:
1)	\Defmac {defmethod-setf} {generic-function-name
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/933L
2)	The macro {\bf defmethod-setf} defines a {\bf setf} method.
2)	\label Syntax:
2)	   (defmethod-setf generic-function-name {qualifier}*
2)	                   specialized-lambda-list
2)	                   setf-lambda-list
2)	     {declaration | doc-string}*
2)	     {form}*)
2)	\Defmac {defmethod-setf} {generic-function-name
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/454L
1)	[Discussion of syntax to be written.]
1)	\label Values:
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/969L
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

2)	The arguments {\it generic-function-name\/}, {\it qualifier\/}, and
2)	{\it specialized-lambda-list\/} are the same as for {\bf defmethod}.
2)	{\it setf-lambda-list\/} is the same as {\it specialized-lambda-list\/}
2)	except that for now there can be only one parameter.  In other words,
2)	{\it setf-lambda-list\/} is a lambda list containing exactly one
2)	required parameter, which may be specialized.  It is either ({\it
2)	variable-name\/}) or (({\it variable-name parameter-specializer\/})).
2)	\label Values:
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/922L
1)	The macro {\bf with-slots} creates a lexical context for using slots
1)	as variables.  Within such a context the slot can be specified by its
1)	slot name, as if it were a lexically bound variable.  The macro 
1)	{\bf with-slots} translates an appearance of the slot name as a variable
1)	into a call to the accessor defined by {\bf defclass}.
1)	\label Syntax:  
1)	\Defmac {with-slots} {\paren {\star{\curly{var $\vert$ varspec}}} \star{\form}}
1)	{\it varspec\/}::$=$ {\paren {var {\star{\curly{options}}}}}
1)	{\it options\/}::$=$  {\tt\vtop{\hbox{:use-accessor {\it flag\/} $\vert$}
1)	\hbox{:class {\it class-name\/} $\vert$}
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/1444L
2)	The macro {\bf with-slots} creates a lexical context for using slots as
2)	variables.  Within such a context the slot can be specified by its slot
2)	name, as if it were a lexically bound variable.   {\bf setf} and {\bf
2)	setq} can be used to set the value of the slot. 
2)	The macro {\bf with-slots} translates an appearance of the slot name as
2)	a variable into a call to the accessor generated by {\bf defclass}
2)	(unless ({\bf :use-accessors nil}) is specified.
2)	\label Syntax:  
2)	(with-slots ({instance | (instance {option}*)}* form*)
2)	\Defmac {with-slots} {\paren {\star{\curly{var-name $\vert$ varspec}}} \star{\form}}
2)	{\it varspec\/}::$=$ {\paren {var-name {\star{\curly{options}}}}}
2)	{\it options\/}::$=$  {\tt\vtop{\hbox{:use-accessor {\it t-or-nil\/} $\vert$}
2)	\hbox{:class {\it class-name\/} $\vert$}
***************


**** File 1) FUNCTI.2[CLS,LSP]/1P/940L
1)	The {\it prefix\/} argument is a string that is prefixed to the slot
1)	name.  No prefix is used if {\it prefix\/} is not specified or is 
1)	{\bf nil} or the null string.
1)	The {\bf :use-accessor} argument in the alternative syntax defaults
1)	to {\bf t}.
1)	\label Values:
1)	The value of the specified slot is returned.
1)	\label Examples:
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

1)	\screen!
1)	[To be written.]
1)	\endscreen!
1)	\label Remarks:
1)	The {\bf setq} special form may be used with a variable specified
1)	with {\bf with-slots}.
1)	It is an error if the class of {\it var} cannot be inferred from the
1)	lexical context in which it occurs.
1)	\endcom
**** File 2) FUNCTI.TEX[CLS,LSP]/1P/1468L
2)	The expression {\it instance\/} must evaluate to an instance; it is
2)	evaluated exactly once.  
2)	It is necessary that the class of the instance can be determined.
2)	Either {\it instance\/} must be the name of a specialized parameter in
2)	the lambda-list of a method lexically containing this {\bf with-slots}
2)	form, or the {\bf :class} option must be used to indicate the class of
2)	the instance.
2)	The recognized keywords and their arguments are:
2)	:class class-name
2)	                The class, or a super class, of the instance.  This option
2)	                is necessary if the class of the instance cannot be
2)	                determined from the lambda-list of a method lexically 
2)			containing this with-slots form.
2)	:prefix prefix-string
2)	                When you use this option you can
2)	                reference a slot by the variable named by prefix followed
2)	                by the slot name.  This enables you to keep separate two
2)	                instances whose slot names overlap, such as when you want
2)	                to access two instances of the same class, or that share a
2)	                super-class.
2)	:use-accessors t-or-nil
2)			If t, when a slot is accessed, the accessor function
2)			generated by defclass is used to access the slots; this
2)			means that any methods written for the accessor are also
2)			run.   t is the default.   If nil, with-slots accesses 
2)			the slots using slot-value instead of the accessor.
2)			If the {\bf defclass} form did not specifically generate 
2)	                accessors, the ({\bf :use-accessors nil} option should be used. 
2)	\label Values:
2)	The value of the {\bf with-slots} form itself is whatever is returned by
2)	the last form in its body. 
2)	\label Examples:
2)	\screen!
2)	(defclass point ((x 0) (y 0)) ()
2)	  (:accessor-prefix point-))
2)	(defmethod move ((p point) dx dy)
2)	  (with-slots (p)  ;; p is known as a point from the method args
2)	    (setf x (+ x dx) y (+ y dy))))
  1) FUNCTI.2[CLS,LSP] and 2) FUNCTI.TEX[CLS,LSP]	10-20-86 16:25	pages 1,1

2)	(defmethod move ((p point) dx dy)
2)	  (with-slots ((p :use-accessors nil))
2)	    (setf x (+ x dx) y (+ y dy))))
2)	(defmethod make-same-height ((p1 point) (p2 point))
2)	;;; set the y coord of p1 to the y of p2, its reference.
2)	;;; slots of p1 are accessed using the slot names
2)	;;; slots of p2 are accessed using ref-<slot-name>
2)	  (with-slots (p1 :prefix p1- (p2 :prefix p2-))
2)	    (setf p1-y p2-y)))
2)	(defmethod make-horizontal ((l line))
2)	   (let ((left (left-point l)) (right (right-point l)))
2)	     (with-slots ((left  :class point :prefix left-)
2)	                  (right :class point :prefix right-))
2)	       (setf left-y right-y))))
2)	\endscreen!
2)	\label Remarks:
2)	The examples above use {\bf setf} with the variables inside {\bf
2)	with-slots} forms; it is also allowed to use {\bf setq}.  Note that using
2)	{\bf setf} or {\bf setq} with a variable name does not affect the meaning
2)	of the slot itself.
2)	It is an error if the class of {\it instance} cannot be inferred from the
2)	lexical context in which it occurs.   That is, if more than one {\it
2)	instance\/} is given, they must have disjoint sets of names for slots to
2)	avoid ambiguity of reference, or the {\bf :prefix} option must be used
2)	to distinguish between the names.  If any ambiguity is detected, {\bf
2)	with-slots} signals an error.
2)	\endcom
***************